package com.tqfframe.task.learning.other.inheritance;

import com.tqfframe.task.learning.other.inheritance.entity.First;
import com.tqfframe.task.learning.other.inheritance.entity.Script;
import com.tqfframe.task.learning.other.inheritance.entity.Second;
import java.util.HashMap;
import java.util.Map;

/**
 *  定义一个AfterHandlerFactory工厂，用于存放需要调用的AfterHandler容器
 *
 * @Author: 唐祺峰
 * @Date: 2020/7/21 0021 10:16
 * @Version 1.0
 */
public class AfterHandlerFactory {

    private static Map<Class<? extends Script>,AfterHandler<?>> registry= new HashMap<>();

    static {
        registry.put(First.class, new FirstAfterHandler());
        registry.put(Second.class, new SecondAfterHandler());
    }

    public static AfterHandler getAfterHandler(Class<? extends Script> c){
        return registry.get(c);
    }

}
